package com.ncp.servlet.order;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ncp.model.biz.cart.ShoppingCart;
import com.ncp.model.biz.order.ManageAddressBiz;

public class ConfirmOrderServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doPost(request, response);
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		int userID = (Integer)request.getSession().getAttribute("userID");
		//用户常用收货地址
		ManageAddressBiz manageAddress = new ManageAddressBiz();
		List receivers = manageAddress.getReceivers(userID);
		
		//System.out.println("receiver size: " + receivers.size());
		
		request.setAttribute("receivers", receivers);
		//取得购物车信息
		//ShoppingCart cart = (ShoppingCart)request.getSession().getAttribute("cart");
		
		request.getRequestDispatcher("pages/cart/confirmorder.jsp").forward(request, response);		
	}

}
